<template>
    <div class="newsinfo-container">
        <h3 class="title">{{ newsinfo.title }}</h3>
        <p class="subtitle">
            <span>发表时间：{{ newsinfo.add_time | dateFormat }}</span>
            <span>点击：{{ newsinfo.click }}次</span>
        </p>
        <hr>
        <div class="content" v-html="newsinfo.content"></div>

        <!-- 评论子组件区域 -->
        <comment-box :id="this.id"></comment-box>
    </div>
</template>
  


<script>
import comment from '../subcomponents/comment.vue'
export default {
    data() {
        return {
            id: this.$route.params.id,
            newsinfo: {}
        };
    },
    created() {
        this.getNewsInfo();
    },
    methods: {
        getNewsInfo() {
            var content = "<html><p>以土地供应和管理制度为例，自2012年新一轮土地管理制度改革以来，深圳市逐步建立了土地整备、城市更新等存量土地二次开发新机制，对房地产建设管理提出了新要求。此外，随着“深圳90改革”的推进实施，建设项目审批发生了重大调整，部分环节与房地产市场监管密切相关，相关制度也亟待衔接完善。原办法有关房地产市场监管制度更多是在增量土地供应背景下制定的，有必要按照新时期城市建设发展的新要求进行修订完善。</p></html>";
             var body={
                status:0,
                message:[
                    {
                        id: 13,
                        title: "买房还是炒股",
                        add_time:"2015-04-16T03:50:28.000Z",
                        zhaiyao:"买房还是炒股",
                        click:1,
                        content:content
                    },
                    {
                        id: 14,
                        title: "买房还是炒股",
                        add_time:"2015-04-16T03:50:28.000Z",
                        zhaiyao:"买房还是炒股",
                        click:1,
                        content:content
                    },
                    {
                        id: 15,
                        title: "买房还是炒股",
                        add_time:"2015-04-16T03:50:28.000Z",
                        zhaiyao:"买房还是炒股",
                        click:1,
                        content:content
                    },
                    {
                        id: 16,
                        title: "买房还是炒股",
                        add_time:"2015-04-16T03:50:28.000Z",
                        zhaiyao:"买房还是炒股",
                        click:1,
                        content:content
                    },
                    {
                        id: 17,
                        title: "买房还是炒股",
                        add_time:"2015-04-16T03:50:28.000Z",
                        zhaiyao:"买房还是炒股",
                        click:1,
                        content:content
                    },
                    {
                        id: 18,
                        title: "买房还是炒股",
                        add_time:"2015-04-16T03:50:28.000Z",
                        zhaiyao:"买房还是炒股",
                        click:1,
                        content:content
                    },
                    {
                        id: 19,
                        title: "买房还是炒股",
                        add_time:"2015-04-16T03:50:28.000Z",
                        zhaiyao:"买房还是炒股",
                        click:1,
                        content:content
                    },
                    {
                        id: 20,
                        title: "买房还是炒股",
                        add_time:"2015-04-16T03:50:28.000Z",
                        zhaiyao:"买房还是炒股",
                        click:1,
                        content:content
                    },
                    {
                        id: 21,
                        title: "买房还是炒股",
                        add_time:"2015-04-16T03:50:28.000Z",
                        zhaiyao:"买房还是炒股",
                        click:1,
                        content:content
                    },
                    {
                        id: 22,
                        title: "买房还是炒股",
                        add_time:"2015-04-16T03:50:28.000Z",
                        zhaiyao:"买房还是炒股",
                        click:1,
                        content:content
                    },
                    {
                        id: 23,
                       title: "买房还是炒股",
                        add_time:"2015-04-16T03:50:28.000Z",
                        zhaiyao:"买房还是炒股",
                        click:1,
                        content:content
                    },
                    {
                        id: 24,
                        title: "买房还是炒股",
                        add_time:"2015-04-16T03:50:28.000Z",
                        zhaiyao:"买房还是炒股",
                        click:1,
                        content:content
                    }
                    ]
                };
                if(body.status===0) {
                    this.newsinfo = body.message[0]
                }else {
                    Toast("获取新闻失败...")
                }
        }
    },
    components: {
        'comment-box':comment
    }
};

</script>

<style lang="scss">
.newsinfo-container {
    padding: 0 4px;
    .title {
        font-size: 16px;
        text-align: center;
        margin: 15px 0;
        color: red;
    }
    .subtitle {
        font-size: 13px;
        color: #226aff;
        display: flex;
        justify-content: space-between;
    }
    .content {
        img{
            width:100%;
        }
    }
}
</style>
